package file;

import java.io.File;
/*
File(String pathname)：根据一个路径得到File对象
File(String parent, String child):根据一个目录和一个子文件/目录得到File对象
File(File parent, String child):根据一个父File对象和一个子文件/目录得到File对象
 */
public class Demo01_Constructor {
    public static void main(String[] args) {
        extracted();
        extracted1();
        extracted2();


    }

    private static void extracted2() {
        String parent = "D:\\wangdao_study\\studyHard";
        File fileParent = new File(parent);
        String child = "src";
        File file = new File(fileParent,child);
        System.out.println(file.exists());
    }

    private static void extracted1() {
        String parent = "D:\\wangdao_study\\studyHard";
        String child = "src";
        File file = new File(parent,child);
        System.out.println(file.exists());
    }

    private static void extracted() {
        File file = new File("D:\\wangdao_study\\studyHard\\src");

        //file.exists()：判断当前文件是否存在
        System.out.println(file.exists());
    }
}
